<!DOCTYPE html>
<html>
<head>
  <title>点击下载图片</title>
</head>
<body>
  <button onclick="downloadImage()">下载图片</button>

  <script>
    function downloadImage() {
      // 替换这里的图片URL为您要下载的图片URL
      const imageUrl = 'https://img.alicdn.com/tfs/TB13DzOjXP7gK0jSZFjXXc5aXXa-212-48.png';

      var image = new Image();//创建一个Image图片
      
      image.src = imageUrl;
      image.setAttribute('crossOrigin', 'anonymous');
      image.onload = function () {//图片加载处理函数
        var canvas = document.createElement('canvas');
        canvas.width = image.width;//canvas画布
        canvas.height = image.height;
        var context = canvas.getContext('2d');
        context.drawImage(image, 0, 0, image.width, image.height);
        var url = canvas.toDataURL('image/png')
        var a = document.createElement('a');
        var event = new MouseEvent('click');
        a.download = '活动图片二维码';
        a.href = url;
        a.dispatchEvent(event);
      }
    }
  </script>
</body>
</html>
